/*************************************************************************
> File Name: member_fun.cpp
> Author: hzy
> Created Time: 2023-08-19 15:50:57
> Description:
************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Data
{
private:
    int a;
    int b;

public:
    Data() {}
    Data(int a, int b)
    {
        this->a = a;
        this->b = b;
    }

    void showData()
    {
        cout << "a = " << a << ",b = " << b << endl;
    }
};

int main()
{
    vector<Data> v;

    v.push_back(Data(1, 2));
    v.push_back(Data(3, 4));
    v.push_back(Data(5, 6));
    v.push_back(Data(7, 8));
    v.push_back(Data(9, 10));

    for_each(v.begin(), v.end(), mem_fun_ref(&Data::showData));

    return 0;
}